import Taro from '@tarojs/taro'
import { AtButton } from 'taro-ui'
import { View,} from '@tarojs/components'

import { MineHeader,MineItem } from '../../components'
import icon1 from '../../images/resume.png'
import icon2 from '../../images/post.png'
import icon3 from '../../images/favorite.png'
import icon4 from '../../images/message.png'
import icon5 from '../../images/mylesson.png'
import icon6 from '../../images/makeInvoice.png'
import icon7 from '../../images/aboutUs.png'

import './index.scss'

export default function Mine() {

const appInfo=Taro.getAccountInfoSync()
console.log(appInfo)
  const quit=()=>{
    Taro.removeStorageSync(`auth`)
    Taro.removeStorageSync(`openid`)
    Taro.removeStorageSync(`data_expiration`)
    // console.log(Taro.getStorageSync(`auth`));
    Taro.reLaunch({
      url: `/pages/index/index`,
    })
  }
  const login=()=>{

    // console.log(Taro.getStorageSync(`auth`));
    Taro.reLaunch({
      url: `/pages/login/login`,
    })
  }




    return (

      <View className='index'>
        {/* <Text>Hello mine!</Text> */}
        <MineHeader />
        <MineItem src={icon1} context='我的简历' jumpto='myResume' />
        <MineItem src={icon2} context='我的投递' jumpto='myPost' />
        <MineItem src={icon3} context='我的收藏' jumpto='myFavorite' />
        <MineItem src={icon4} context='我的消息' />
        <MineItem src={icon5} context='我的课程' />
        <MineItem src={icon6} context='开票申请' />
        <MineItem src={icon7} context='关于我们' jumpto='aboutUs' />


        <View className='versionAlarm'>当前版本:{appInfo.miniProgram.version?appInfo.miniProgram.version:`1.0.4`}</View>

{    Taro.getStorageSync(`auth`)?<AtButton className='button' circle onClick={quit}> 退出</AtButton>:<AtButton className='button' circle onClick={login}> 登录</AtButton>}
      </View>
    )
  }

